|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.realtime.AsyncEvent
javax.realtime.Timer
A Timer
is a timed event that measures time relative to a given
Clock
.
This class defines basic functionality available to all timers.
Applications will generally use either
PeriodicTimer
to create an event
that is fired repeatedly at regular intervals, or
OneShotTimer
for an
event that just fires once at a specific time. A timer is always based
on a
Clock
, which provides the basic facilities of something that ticks
along following some time line (real-time, cpu-time, user-time, simulation-time,
etc.). All timers are created disabled and do nothing until start()
is
called.
Field Summary | |
protected Clock |
clock
|
protected HighResolutionTime |
time
|
Fields inherited from class javax.realtime.AsyncEvent |
handlers |
Constructor Summary | |
protected |
Timer(HighResolutionTime time,
Clock clock,
AsyncEventHandler handler)
Constructor. |
Method Summary | |
ReleaseParameters |
createReleaseParameters()
Create a ReleaseParameters
block appropriate to the timing characteristics
of this event. |
void |
destroy()
Stop this from counting and return as many of its resources as possible back to the system. |
void |
disable()
Disable this timer, preventing it from firing. |
void |
enable()
Re-enable this timer after it has been disabled. |
Clock |
getClock()
Return the Clock that this timer is based on. |
AbsoluteTime |
getFireTime()
Get the time at which this event will fire. |
boolean |
isRunning()
Tests this to determine if this has been started and is in a state (enabled) such that when the given time occurs it will fire the event. |
void |
reschedule(HighResolutionTime time)
Change the scheduled time for this event. |
void |
start()
A Timer starts measuring time from when it is
started. |
boolean |
stop()
Stops a timer that is running and changes its state to not started. |
Methods inherited from class javax.realtime.AsyncEvent |
addHandler, bindTo, fire, handledBy, removeHandler, setHandler, unbindTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected HighResolutionTime time
protected Clock clock
Constructor Detail |
protected Timer(HighResolutionTime time, Clock clock, AsyncEventHandler handler)
time
- The time to fire the event, Will be converted to absolute
time [sic]clock
- The clock on which to base this time. If null
,
the system realtime clock is used.handler
- The default handler to use for this event. If
null
, no
handler is associated with it and nothing will happen when this event fires
until a handler is provided.Method Detail |
public ReleaseParameters createReleaseParameters()
ReleaseParameters
block appropriate to the timing characteristics
of this event. The default is the most pessimistic:
AperiodicParameters
.
This is typically called by code that is setting up a handler for this event
that will fill in parts of the release parameters that it knows the values
for, like cost.Not currently implemented
createReleaseParameters
in class AsyncEvent
ReleaseParameters
.public void destroy()
Not currently implemented
public void disable()
disable()
is called at time 30 and enable()
is called at time 40 the
firing will occur at time 42 (not time 52). These semantics imply also, that
firings are not queued. Using the above example, if enable was called at
time 43 no firing will occur, since at time 42 this was disabled.Not currently implemented
public void enable()
Timer.disable()
.Not currently implemented
public Clock getClock()
Clock
that this timer is based on.
public AbsoluteTime getFireTime()
Not currently implemented
AbsoluteTime
object
representing the absolute time at which this will fire.public boolean isRunning()
Not currently implemented
public void reschedule(HighResolutionTime time)
Not currently implemented
time
- The time to reschedule for this event firing; if time is
null
,
the previous fire time is still the time at which this will fire.public void start()
Timer
starts measuring time from when it is
started.Not currently implemented
public boolean stop()
Not currently implemented
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |